package es.demo.po;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;

/**
 * 测试向students索引读写数据
 */
@Data
@AllArgsConstructor
//提供了当前po对象对应的索引
@Document(indexName = "student_index")
//索引属性setting配置 分片和副本
@Setting(shards = 1,replicas = 0)
public class StudentEsPO {
    @Id//表示每一个文档对象 索引中的id都使用业务数据字段id
    @Field(type= FieldType.Integer)//{id:{type:integer}}
    private Integer id;
    @Field(type=FieldType.Keyword)
    private String name;
    @Field(type=FieldType.Text,analyzer = "ik_max_word")
    private String profile;
}
